﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.IO;
using System.Windows.Forms;


namespace LectorXML
{
    [WebServiceBinding(Name = "FileSharingSoap", Namespace = "http://tempuri.org")]
    public class FileSharingProxy : MobileWebServerClientProtocol
    {
        public FileSharingProxy(string serverURL)
        {
            this.Url = serverURL;
        }

        [MobileWebServerExtension]
        [SoapHeader("SecurityHeader")]
        [SoapDocumentMethodAttribute("http://tempuri.org/GetFileNames",
                                     RequestNamespace = "http://tempuri.org/",
                                     ResponseNamespace = "http://tempuri.org/",
                                     Use = System.Web.Services.Description.SoapBindingUse.Literal,
                                     ParameterStyle = SoapParameterStyle.Wrapped)]
        public FileShareInfo[] GetFileNames(string path)
        {
            object[] results = this.Invoke("GetFileNames", new object[] { path });
            return ((FileShareInfo[])(results[0]));
        }

        [SoapDocumentMethodAttribute("http://tempuri.org/GetFiles",
                                     RequestNamespace = "http://tempuri.org/",
                                     ResponseNamespace = "http://tempuri.org/",
                                     Use = System.Web.Services.Description.SoapBindingUse.Literal,
                                     ParameterStyle = SoapParameterStyle.Wrapped)]
        [MobileWebServerExtension]
        [SoapHeader("SecurityHeader")]
        public void GetFiles(string[] files)
        {
            this.Invoke("GetFiles", new object[] { files });
        }
        [MobileWebServerExtension]
        [SoapHeader("SecurityHeader")]
        [SoapDocumentMethodAttribute("http://centraldealarmas.cl/Emergencias",
                             RequestNamespace = "http://centraldealarmas.cl/",
                             ResponseNamespace = "http://centraldealarmas.cl/",
                             Use = System.Web.Services.Description.SoapBindingUse.Literal,
                             ParameterStyle = SoapParameterStyle.Wrapped)]
        public void Emergencias()
        {
            try
            {
                this.Invoke("Emergencias", null);
            }
            catch(Exception ex){
                System.Windows.Forms.MessageBox.Show("Error invocar " + ex.Message + "\n" + ex.StackTrace);
            }
        }
        [MobileWebServerExtension]
        [SoapHeader("SecurityHeader")]
        public void Carro(string carro)
        {
            this.Invoke("Carro", new object[] { carro});
        }
        [MobileWebServerExtension]
        [SoapHeader("SecurityHeader")]
        public void CarrosActualiza(string nombre, string lat, string lon)
        {
            this.Invoke("CarrosActualiza", new object[] { nombre,lat,lon });
        }
        [MobileWebServerExtension]
        [SoapHeader("SecurityHeader")]
        public void Carros()
        {
            this.Invoke("Carros",null);
        }
        [MobileWebServerExtension]
        [SoapHeader("SecurityHeader")]
        public void Llamados()
        {
            this.Invoke("Llamados", null);
        }
        [MobileWebServerExtension]
        [SoapHeader("SecurityHeader")]
        public void Llamado(string numero)
        {
            this.Invoke("Llamado", new object[] { numero });
        }
        [MobileWebServerExtension]
        [SoapHeader("SecurityHeader")]
        public void FileSave(string filename, byte[] data)
        {
            this.Invoke("FileSave", new object[] { filename,data });
        }
    }

    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://tempuri.org/")]
    public partial class FileShareInfo
    {
        private string _Fullname;

        public string Fullname
        {
            get { return _Fullname; }
            set { _Fullname = value; }
        }
        private long _Length;

        public long Length
        {
            get { return _Length; }
            set { _Length = value; }
        }
    }
}

